package com.example.safeassistan.home.adapter;

import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.safeassistan.R;
import com.example.safeassistan.home.model.TaskCheckTypeModel;
import com.example.safeassistan.home.model.TaskPersonListModel;

import java.util.List;

public class TaskCheckPersonListAdapter extends BaseQuickAdapter<TaskPersonListModel.ResultDTO,BaseViewHolder> {
    public TaskCheckPersonListAdapter(@Nullable List<TaskPersonListModel.ResultDTO> data) {
        super(R.layout.item_user_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, TaskPersonListModel.ResultDTO item) {
        ImageView ivSelected=helper.getView(R.id.ivSelected);
        helper.setText(R.id.tvText,item.getRealname());
        if (item.getSelect()==null){
            item.setSelect(false);
        }

        if (item.getSelect()){
            ivSelected.setImageResource(R.mipmap.kj_icon_selected);
        }else {
            ivSelected.setImageResource(R.mipmap.kj_icon_unselected);
        }

        helper.addOnClickListener(R.id.ivSelect);
    }


}
